var express=require("express");
var app=express();
var jwt=require("jsonwebtoken");


app.get("/",function(req,res){
  
  //创建token码
  //jwt.sign(要加密的数据,秘钥)
  var data={
    uname:"zhangsan",
    uage:18,
    tidian:"xiu"
  }
  var mi="sdsadsadadsagfghgh";
  var token=jwt.sign(data, mi, {expiresIn:'60s'});
  
  //校验
  //jwt.verify(要校验的token,秘钥,回调)
  jwt.verify(token,mi,function(err,data){
    console.log(err);				//正确就是null
    console.log(data)
  })
  
  
  console.log(token)
  res.send("token成功")
})

app.listen(3000)
